home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
asmsrc
/
phagexsources.lha
/
source
/
AnimPlayer.s
next >
Wrap
Text File
|
1994-07-09
|
7KB
|
460 lines
; IFF Anim Player, plays 2 colour anims directly from DPaint. But it aint
; as fast as DPaint, cuz DP uses a different memory hungry / speedier
; routine.
Opt c-
Section "AnimPlayer",Code_c
IncDir Df1:
Piccy1 = $c0000
Piccy2 = $c3000
Start Movem.l d0-d7/a0-a6,-(sp)
Bsr KillSys
Lea CopperList(pc),a0
Lea HardWare,a6
Move.l a0,Cop1Lc(a6)
Move.w #$83c0,DMACon(a6)
Bsr DoAnim
Bsr ReturnSys
Movem.l (sp)+,d0-d7/a0-a6
Moveq #0,d0
Rts
DoAnim Lea FrameLists(pc),a0
Lea FramePtr(pc),a1
Move.l a0,(a1)
Bsr ConvertIFF
Bsr CopyIFF
Lea FrameLists(pc),a0
Lea FramePtr(pc),a1
Move.l a0,(a1)
AnimLoop Bsr VBL
Bsr DoubleBuffer
Bsr AnimFrame
Btst #6,$Bfe001
Bne AnimLoop
Rts
DoubleBuffer Lea ScreenBase1(pc),a0
Move.l 0(a0),d0
Move.l 4(a0),d1
Move.l d0,4(a0)
Move.l d1,0(a0)
Lea CopperBPLS(pc),a0
Move.w d0,6(a0)
Swap d0
Move.w d0,2(a0)
Rts
VBL Move.l $Dff004,d0
And.l #$1ff00,d0
Cmp.l #$13000,d0
Bne VBL
Rts
ConvertIFF Lea AnimGFXData(pc),a1
Move.l (a1)+,d0
Cmp.l #'FORM',d0
Beq FoundIFF
Rts
FoundIFF Move.l (a1)+,d1
NewForm Move.l (a1)+,d0
Cmp.l #"ANIM",d0
Beq GetAnim
Cmp.l #"ILBM",d0
Beq GetAnim
Rts
GetAnim Move.l (a1)+,d0
Move.l (a1)+,d1
Cmp.l #"FORM",d0
Beq NewForm
Cmp.l #"BMHD",d0
Beq GetBitVars
Cmp.l #"BODY",d0
Beq DecrunchIFF
Cmp.l #"DPAN",d0
Beq GetAnimVar
Cmp.l #"DLTA",d0
Beq GetDeltas
EndHunk Add.l d1,a1
Btst #0,d1
Beq SkipTest
Addq.l #1,a1
SkipTest Lea AnimGFXData(pc),a5
Add.l #EndFile-AnimGFXData,a5
Cmp.l a5,a1
Blt GetAnim
ExitConv Rts
GetBitVars Lea FrameWidth(pc),a5
Move.w 0(a1),0(a5)
Move.b 8(a1),2(a5)
Bra EndHunk
GetAnimVar Lea FrameAm(pc),a5
Move.w 2(a1),(a5)
Bra.w EndHunk
DecrunchIFF Move.l ScreenBase1(pc),a3
Move.l d1,d7
Move.l a1,a2
Move.l a2,a4
Add.l d1,a4
DecLoop Moveq #0,d0
Move.b (a2)+,d0
Bmi GetByte
DataLoop Move.b (a2)+,(a3)+
Dbf d0,DataLoop
Bra CheckLast
GetByte Cmp.b #-128,d0
Beq CheckLast
Neg.b d0
Move.b (a2)+,d2
ByteLoop Move.b d2,(a3)+
Dbf d0,ByteLoop
CheckLast Cmpa.l a2,a4
Bgt DecLoop
Bra EndHunk
GetDeltas Move.l a1,a2
Move.l FramePtr(pc),a4
Moveq #0,d3
Move.b BitplaneAm(pc),d3
Subq.b #$1,d3
SetPointers Move.l (a2)+,d2
Beq NoPoint
Add.l a1,d2
NoPoint Move.l d2,(a4)+
Dbf d3,SetPointers
Lea FramePtr(pc),a5
Move.l a4,(a5)
Bra EndHunk
AnimFrame Move.l FramePtr(pc),a0
Move.l ScreenBase1(pc),a5
Moveq #0,d0
Moveq #0,d1
Moveq #0,d2
Moveq #0,d4
Moveq #0,d5
Moveq #0,d6
Moveq #0,d7
Move.b BitplaneAm(pc),d7
Move.w FrameWidth(pc),d5
Asr.w #3,d5
Move.w d5,d6
Mulu d7,d6
StartBitPlane Move.l (a0)+,a1
Cmp.l #0,a1
Beq NextBitPlane
Move.l a5,a4
Move.w d5,d4
StartColumn Move.b (a1)+,d0
Beq NextColumn
Move.l a4,a3
Depack Move.b (a1)+,d1
Beq ByteRun
Bpl SkipScans
And.w #$7f,d1
CopyData Move.b (a1)+,(a3)
Lea (a3,d6.w),a3
Subq.b #$1,d1
Bne CopyData
Bra NextCode
ByteRun Move.b (a1)+,d1
Move.b (a1)+,d2
Replicate Move.b d2,(a3)
Lea (a3,d6.w),a3
Subq.b #$1,d1
Bne Replicate
Bra NextCode
SkipScans Lea (a3,d6.w),a3
Subq.b #$1,d1
Bne SkipScans
NextCode Subq.w #$1,d0
Bne Depack
NextColumn Addq #1,a4
Subq.w #$1,d4
Bne StartColumn
NextBitPlane Lea (a5,d5.w),a5
Subq.b #$1,d7
Bne StartBitPlane
Lea CurrFrame(pc),a6
Addq.w #1,0(a6)
Move.l a0,2(a6)
Move.w FrameAm(pc),d1
Cmp.w CurrFrame(pc),d1
Bge SkipCell
Lea CurrFrame(pc),a6
Lea FrameLists+4(pc),a5
Move.w #1,0(a6)
Move.l a5,2(a6)
SkipCell Rts
CopyIFF Lea Piccy1,a0
Lea Piccy2,a1
Lea $Dff000,a6
Bsr WaitBlitter
Move.l #-1,BltAFWM(a6)
Move.l #$09f00000,BltCon0(a6)
Move.l a0,BltAPth(a6)
Move.l a1,BltDPth(a6)
Move.l #0,BltAMod(a6)
Move.w #(256*64)+20,BltSize(a6)
Rts
WaitBlitter Btst #$6,$2(a6)
Bne WaitBlitter
Rts
KillSys Bsr.s SysWait
Move.l $4,a6
Lea GFXName(pc),a1
Moveq #0,d0
Jsr -552(a6)
Lea OldCop1(pc),a5
Move.l $26(a0),$0(a5)
Move.l $32(a0),$4(a5)
Lea HardWare,a6
Move.w IntEnaR(a6),d0
Move.w DMAConR(a6),d1
Or.w #$8000,d0
And.w #$03ff,d1
Or.w #$8000,d1
Move.w d0,$8(a5)
Move.w d1,$a(a5)
Move.w #$7fff,IntEna(a6)
Move.w #$7fff,DMACon(a6)
Rts
SysWait Move.w #15,d7
SysWaitLoop Move.l #$05000,d1
Bsr.s WaitVBL
Bsr.s DoWaitVBL
Dbf d7,SysWaitLoop
Rts
DoWaitVBL Move.l #$03000,d1
WaitVBL Movem.l d0-d1/a6,-(sp)
Lea HardWare,a6
WaitVBLLoop Move.l VPosR(a6),d0
And.l #$1ff00,d0
Cmp.l d1,d0
Bne.s WaitVBLLoop
Movem.l (sp)+,d0-d1/a6
Rts
ReturnSys Lea HardWare,a6
Move.w OldIntEna(pc),IntEna(a6)
Move.w OldDMACon(pc),DMACon(a6)
Move.l OldCop1(pc),Cop1lc(a6)
Move.l OldCop2(pc),Cop2lc(a6)
Rts
GFXName Dc.b "graphics.library",0
Even
OldCop1 Dc.l 0
OldCop2 Dc.l 0
OldIntEna Dc.w 0
OldDmaCon Dc.w 0
ScreenBase1 Dc.l Piccy1
ScreenBase2 Dc.l Piccy2
FrameWidth Dc.w 0
BitplaneAm Dc.w 0
FrameAm Dc.w 0
CurrFrame Dc.w 0
FramePtr Dc.l 0
FrameLists Ds.l 50*6
Cmv Macro
Dc.w \2,\1
EndM
Cwt Macro
Dc.w (\1*$100)+$01,$fffe
EndM
Pal Macro
Dc.w $ffe1,$fffe
EndM
EndCop Macro
Dc.w $ffff,$fffe
EndM
CopperList Cwt $15
Cmv $0200,BplCon0
Cmv $00bb,BplCon1
Cmv $000a,BplCon2
Cmv $0034,DdfStrt
Cmv $00c8,DdfStop
Cmv $1681,DiwStrt
Cmv $36c1,DiwStop
Cmv $0,BplMod1
Cmv $0,BplMod2
Cwt $25
Cmv $0000,Color00
Cmv $0fff,Color01
CopperBPLS Cmv $0,BplPt0h
Cmv $0,BplPt0l
Cmv $0,BplPt1h
Cmv $0,BplPt1l
Cmv $0,BplPt2h
Cmv $0,BplPt2l
Cmv $0,BplPt3h
Cmv $0,BplPt3l
Cmv $0,BplPt4h
Cmv $0,BplPt4l
Cwt $28
Cmv $1200,BplCon0
Pal
Cwt $28
Cmv $0200,BplCon0
EndCop
AnimGFXData Incbin df0:Graphics/Anim2.IFF
EndFile
****Custom Chip Registers****
Hardware = $Dff000
;Control Registers
Dmaconr = $002
Vposr = $004
Vhposr = $006
Joy0dat = $00A
Joy1dat = $00C
Clxdat = $00E
Intenar = $01C
Intereqr = $01E
Copcon = $02E
;Blitter Registers
Bltcon0 = $040
Bltcon1 = $042
Bltafwm = $044
Bltalwm = $046
Bltcpth = $048
Bltcptl = $04A
Bltbpth = $04C
Bltbptl = $04E
Bltapth = $050
Bltaptl = $052
Bltdpth = $054
Bltdptl = $056
Bltsize = $058
Bltcmod = $060
Bltbmod = $062
Bltamod = $064
Bltdmod = $066
Bltcdat = $070
Bltbdat = $072
Bltadat = $074
;Copper Registers
Cop1lc = $080
Cop1lch = $080
Cop1lcl = $082
Cop2lc = $084
Cop2lch = $084
Cop2lcl = $086
Copjmp1 = $088
Copjmp2 = $08A
Diwstrt = $08E
Diwstop = $090
Ddfstrt = $092
Ddfstop = $094
Dmacon = $096
Clxcon = $098
Intena = $09A
Intreq = $09C
;BitPlane Registers
BplCon0 = $100
BplCon1 = $102
BplCon2 = $104
BplMod1 = $108
BplMod2 = $10a
BplPt0h = $0e0
BplPt0l = $0e2
BplPt1h = $0e4
BplPt1l = $0e6
BplPt2h = $0e8
BplPt2l = $0ea
BplPt3h = $0ec
BplPt3l = $0ee
BplPt4h = $0f0
BplPt4l = $0f2
BplPt5h = $0f4
BplPt5l = $0f6
;Colour Registers
Color00 = $180
Color01 = $182
Color02 = $184
Color03 = $186
Color04 = $188
Color05 = $18a
Color06 = $18c
Color07 = $18e
Color08 = $190
Color09 = $192
Color10 = $194
Color11 = $196
Color12 = $198
Color13 = $19a
Color14 = $19c
Color15 = $19e
Color16 = $1a0
Color17 = $1a2
Color18 = $1a4
Color19 = $1a6
Color20 = $1a8
Color21 = $1aa
Color22 = $1ac
Color23 = $1ae
Color24 = $1b0
Color25 = $1b2
Color26 = $1b4
Color27 = $1b6
Color28 = $1b8
Color29 = $1ba
Color30 = $1bc
Color31 = $1be
EcsNop = $1fe